//
//  AVPlayerManager.h
//  MusicPlayer
//
//  Created by lanou3g on 16/5/11.
//  Copyright © 2016年 韩宏. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>

@protocol AVPlayerManagerDelegate <NSObject>

//播放时间的改变
- (void)changeTime:(CGFloat)time;
//播放完成
- (void)playFinished;

@end

//播放状态
typedef NS_ENUM(NSUInteger, AVPlayerManagerStatus) {
    //正在播放
    AVPlayerPlaying,
    //暂停
    AVPlayerPause,
    //停止播放
    AVPlayerStop,
};

typedef NS_ENUM(NSUInteger, LoopType) {
    SingleType,//单曲循环
    ShuffleType,//随机播放
    OrderTpye,//顺序播放
};

@interface AVPlayerManager : NSObject {
    //播放状态
    AVPlayerManagerStatus _status;
    //播放方式
    LoopType _loopType;
}
@property (nonatomic) AVPlayerManagerStatus status;

@property (nonatomic) LoopType loopType;

@property (nonatomic, assign) CGFloat volume;

//当前的Item播放时间,单位是秒(second)
@property (nonatomic) CGFloat currentTime;

//创建一个viewController
@property (nonatomic, strong) UIViewController *playVC;

//代理属性
@property (nonatomic, weak) id<AVPlayerManagerDelegate>delegate;

//单例
+ (AVPlayerManager *)shareHandle;

//加载播放歌曲
- (void)playWithMusicUrl:(NSString *)musicUrl;

//播放
- (void)play;

//暂停
- (void)pause;

//根据时间播放歌曲
- (void)seekToTime:(CGFloat)time;

@end
